
<script type="text/html" template>
  <link rel="stylesheet" href="{{ layui.setter.base }}style/login.css?v={{ layui.admin.v }}-1" media="all">
</script>
<style>
 .layadmin-tabspage-none{background: url("/src/style/res/img/loginbj.png") no-repeat center bottom #38a8d8;background-size: 100% auto;}
</style>
<!-- layui-container 不全屏  layui-fluid 全屏-->
<div class="layui-fluid  layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
  <div class="layui-row">
    <div class="layadmin-user-login-header">
      <h2><img class="logo" src="/src/style/res/img/logo.png"><!--<a class="reg" lay-href="/user/reg">注册新用户</a>--> </h2>
    </div>
  </div>
  <div class="layui-row layadmin-user-login-middle">
      <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
          <div class="layui-form-items">
            <div class="layui-form-item">
              <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"><span>账号</span></label>
              <input type="text" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="请输入手机号码 / 邮箱" class="layui-input">
            </div>
            <div class="layui-form-item">
              <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"><span>密码</span></label>
              <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="请输入密码" class="layui-input">
            </div>
          </div>

          <div class="layui-form-item layui-form-tag">
            <input type="checkbox" name="remember" lay-skin="primary" title="下次自动登录">
            <a lay-href="/user/forget" class="layadmin-user-jump-change layadmin-link" style="color: #47b6df;">忘记密码？</a>
          </div>
          <div class="layui-form-item">
            <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">立即登录</button>
          </div>
          <!-- <div class="layui-trans layui-form-item layadmin-user-login-other">
             <label>社交账号登入</label>
             <a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
             <a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
             <a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
             <a lay-href="/user/reg" class="layadmin-user-jump-change layadmin-link">注册帐号</a>
           </div>-->
        </div>
      </div>
  </div>
  <div class="layui-row">
    <!--<div class="layui-trans layadmin-user-login-footer">
      <p> ©2014 - 2018 重庆源狼软件科技有限责任公司 京ICP备12043664号-13  京公网安备 11010801000158</a></p>
      &lt;!&ndash;    <p>
            <span><a href="" target="_blank">在线支持17784263915</a></span>
            <span><a href="" target="_blank">在线QQ778142659</a></span>
          </p>&ndash;&gt;
    </div>-->
  </div>
</div>

<script>
layui.use(['admin', 'form', 'user','common'], function(){
  var $ = layui.$
  ,setter = layui.setter
  ,admin = layui.admin
  ,form = layui.form
  ,router = layui.router()
  ,search = router.search
  ,common = layui.common ;
  form.render();
  //提交
  form.on('submit(LAY-user-login-submit)', function(obj){
    //请求登入接口
    admin.req({
      url: common.basePath+'login/doLogin.do' //实际使用请改成服务端真实接口
      ,data: obj.field
      ,dataType:"json"
      ,done: function(res){
        if(res.code == 1001){
          layer.msg(res.msg, {
            offset: '15px'
            ,icon: 1
            ,time: 1000
          });
          return ;
        }
        //请求成功后，写入 access_token
        layui.data(setter.tableName, {
          key: setter.request.tokenName
          ,value: res.data.access_token
        });
        //登入成功的提示与跳转
        layer.msg('登入成功', {
          offset: '15px'
          ,icon: 1
          ,time: 1000
        }, function(){
          location.hash = search.redirect ? decodeURIComponent(search.redirect) : '/';
        });
      }
    });
  });

//实际使用时记得删除该代码
/*  layer.msg('为了方便演示，用户名密码可随意输入', {
    offset: '15px'
    ,icon: 1
  });*/
  
});
</script>